﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace PClusterModel.Cluster
{
    public class PCluster: IMicroarrayCluster
    {
        private IList<IMicroarrayDataObject> objectsInCluster;
        private BitArray clusteringConditions;
        private int numberOfObjects;
        private int numberOfCoditions;

        public PCluster(IList<IMicroarrayDataObject> objects, BitArray conditions)
        {
            this.objectsInCluster = objects;
            this.clusteringConditions = conditions;
        }

        #region IMicroarrayCluster<IMicroarrayDataObject> Members

        public IList<IMicroarrayDataObject> ObjectsInCluster
        {
            get { return this.objectsInCluster; }
        }

        public BitArray ClusteringConditions
        {
            get { return this.clusteringConditions; }
        }

        public int NumberOfObjects
        {
            get
            {
                if (this.numberOfObjects == 0)
                {
                    this.numberOfObjects = this.objectsInCluster.Count;
                }
                return this.numberOfObjects;
            }
        }

        public int NumberOfConditions
        {
            get
            {
                if (this.numberOfCoditions == 0)
                {
                    this.numberOfCoditions = Utils.Utilities.GetNumberOfSetBitsForBitmap(this.clusteringConditions);
                }
                return this.numberOfCoditions;
            }
        }

        #endregion
    }

}
